package com.alipay.sofa.award.record.biz.impl.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * DateFormatUtils
 *
 * @author yangguanchao
 * @since 2018/09/04
 */
public class DateFormatUtils {

    private static final String FORMAT_PATTERN = "yyyy-MM-dd";

    public static String getLastDay(Date dateNow) {
        SimpleDateFormat format = new SimpleDateFormat(FORMAT_PATTERN);
        //last day
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(dateNow);
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        return format.format(calendar.getTime());
    }
}
